import 'package:flutter/material.dart';
import 'package:flutter_ability/custom_ui.dart';

class ListPage2 extends StatefulWidget {
  const ListPage2({Key? key}) : super(key: key);

  @override
  State<ListPage2> createState() => _ListPage2State();
}

class _ListPage2State extends State<ListPage2> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: YJAppBar(
        isScaffold: true,
        title: TextView.text("List 列表"),
        backgroundColor: YJColors.WHITE,
      ),
      body: Container(
        padding: const EdgeInsets.only(left: 16, right: 16),
        child: buildCenter(context),
      ),
      backgroundColor: YJColors.BACKGROUND_COLOR,
    );
  }

  buildCenter(BuildContext context) {
    return SingleChildScrollView(
      scrollDirection: Axis.vertical,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          const SizedBox(height: 10),
          YJListTile(
            onTap: () {},
            titleText: "列表标题",
            subTitleText: "一长串描述提示内容",
            bgColor: YJColors.WHITE,
            margin: const EdgeInsets.only(top: 8),
          ),
          YJListTile(
            onTap: () {},
            titleText: "列表标题",
            subTitleText: "一长串描述提示内容",
            hintTitleText: "提示内容",
            bgColor: YJColors.WHITE,
            iconRight: const SizedBox(),
            margin: const EdgeInsets.only(top: 8),
          ),
          YJListTile(
            onTap: () {},
            title: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Container(
                  alignment: Alignment.bottomCenter,
                  child: TextView.text("*",
                      color: Colors.red,
                      fontSize: YJSize.SP_16,
                      isLineHeight: false),
                ),
                TextView.text("列表标题",
                    fontSize: YJSize.SP_16, color: YJColors.BLACK85)
              ],
            ),
            subTitleText: "一长串描述提示内容",
            bgColor: YJColors.WHITE,
            margin: const EdgeInsets.only(top: 8),
          ),
          YJListTile(
            onTap: () {},
            titleText: "列表标题",
            hintTitleText: "提示内容",
            bgColor: YJColors.WHITE,
            subTitleText: "一长串描述提示内容",
            margin: const EdgeInsets.only(top: 8),
          ),
          YJListTile(
            onTap: () {},
            titleText: "列表标题",
            subTitleText: "一长串描述提示内容",
            avatar: Image.asset('assets/app_icon.png', width: 24, height: 24),
            iconTitle:
                Image.asset('assets/app_icon.png', width: 24, height: 24),
            hintTitle:
                Image.asset('assets/app_icon.png', width: 24, height: 24),
            bgColor: YJColors.WHITE,
            margin: const EdgeInsets.only(top: 8),
          ),
          YJListTile(
            onTap: () {},
            titleText: "列表标题",
            subTitleText: "一长串描述提示内容",
            avatar: Image.asset('assets/app_icon.png', width: 24, height: 24),
            bgColor: YJColors.WHITE,
            margin: const EdgeInsets.only(top: 8),
          ),
          YJListTile(
            onTap: () {},
            titleText: "列表标题",
            subTitleText: "一长串描述提示内容",
            bgColor: YJColors.WHITE,
            hintTitle: TextView.text("+52.8",
                fontSize: YJSize.SP_16,
                color: YJColors.BLACK65,
                isLineHeight: false),
            iconRight: const SizedBox(),
            margin: const EdgeInsets.only(top: 8),
          ),
          YJListTile(
            onTap: () {},
            titleText: "列表标题",
            subTitleText: "一长串描述提示内容",
            bgColor: YJColors.WHITE,
            hintTitle: TextView.text("数据反馈内容",
                fontSize: YJSize.SP_16, color: YJColors.BLACK65),
            margin: const EdgeInsets.only(top: 8),
          ),
          newMethod(),
          const SizedBox(height: 30),
        ],
      ),
    );
  }

  Widget newMethod() {
    return Container(
      width: 40,
      height: 40,
      child: YJAvatar(
        radius: 20,
        backgroundImage: const AssetImage('assets/app_icon.png'),
      ),
    );
  }
}
